package engine.graphics.anim
{
	import engine.core.*;
	import engine.math.*;
	
	public class RxAnimatedParamVector4 extends RxAnimatedParamBase
	{
		protected var m_valueStart:RxVector4;
		protected var m_valueMid:RxVector4;
		protected var m_valueEnd:RxVector4;
		protected var m_amplitude:RxVector4;
		protected var m_frequency:RxVector4;
		protected var m_phase:RxVector4;
		protected var m_valueCurrent:RxVector4;
		private static var s_pool:RxObjectPool = null;
		
		public function RxAnimatedParamVector4()
		{
			this.m_valueStart = new RxVector4();
			this.m_valueMid = new RxVector4();
			this.m_valueEnd = new RxVector4();
			this.m_amplitude = new RxVector4();
			this.m_frequency = new RxVector4();
			this.m_phase = new RxVector4();
			this.m_valueCurrent = new RxVector4();
		}
		
		public static function CreatePool(initSize:uint, growSize:uint) : void
		{
			var allocFunc:* = function () : Object
			{
				return new RxAnimatedParamVector4();
			};
			s_pool = new RxObjectPool(allocFunc, null, initSize, growSize, RxAnimatedParamVector4);
		}
		
		override public function SetupFromXML(xml:XMLList) : void
		{
			super.SetupFromXML(xml);
			var start:* = xml.@valueStart;
			var mid:* = xml.@valueMid;
			var end:* = xml.@valueEnd;
			var vector1:* = new RxVector4();
			var vector2:* = new RxVector4();
			var vector3:* = new RxVector4();
			vector1.CopyFromString(start);
			vector2.CopyFromString(mid);
			vector3.CopyFromString(end);
			this.SetValues(vector1, vector2, vector3);
			var amp:* = xml.@amp;
			var freq:* = xml.@freq;
			var phase:* = xml.@phase;
			this.m_amplitude.CopyFromString(amp);
			this.m_frequency.CopyFromString(freq);
			this.m_phase.CopyFromString(phase);
		}
		
		public function SetValues(vector1:RxVector4, vector2:RxVector4, vector3:RxVector4) : void
		{
			this.m_valueStart.Copy(vector1);
			this.m_valueMid.Copy(vector2);
			this.m_valueEnd.Copy(vector3);
			this.m_valueCurrent.Copy(this.m_valueStart);
		}
	}
}